package org.cy.websocket.stomp.messaging;

import org.cy.websocket.stomp.StompCommand;
import org.cy.websocket.stomp.StompHeaders;

/**
 * Created in 2021-05-10 22:27
 *
 * @author cao.yong
 */
public class GenericMessage<T> implements Message<T> {

    private StompCommand command;

    private StompHeaders headers;

    private T payload;

    public GenericMessage(StompCommand command, T payload) {
        this(command, new StompHeaders(), payload);
    }

    public GenericMessage(StompCommand command, StompHeaders headers, T payload) {
        this.command = command;
        this.headers = headers;
        this.payload = payload;
    }

    @Override
    public StompCommand getCommand() {
        return command;
    }

    public void setCommand(StompCommand command) {
        this.command = command;
    }

    @Override
    public StompHeaders getHeaders() {
        return headers;
    }

    public void setHeaders(StompHeaders headers) {
        this.headers = headers;
    }

    @Override
    public T getPayload() {
        return payload;
    }

    public void setPayload(T payload) {
        this.payload = payload;
    }
}
